<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>后台管理</title>
{{include file="layouts/_head"}}
</head>
<body>
<div class="main">
	<ol class="breadcrumb">
		<li><i class="icon_home iconfont"></i>首页</li>
	  	<li>管理员管理</li>
	  	<li><a href="javascript:history.go(-1);">管理员列表</a></li>
	  	<li class="active">创建</li>
	</ol>
	<div class="bg-danger clearfix main-head-info error-info"></div>
	<div class="main-con">
		<form class="form-horizontal margin-t-30" id="form" method="post" action="{{:url('/admin/administrator/store')}}">
			<input type="hidden" name="__token__" value="{{$Request.token}}" />
		  	<div class="tab-box">	
			  	<div class="form-group">
			    	<span class="col-sm-2 control-label"><span class="color-red">*</span> 用户名：</span>
			    	<div class="col-sm-8 input-group"><input class="form-control" name="username"></div>
			  	</div>
			  	<div class="form-group">
			    	<span class="col-sm-2 control-label"><span class="color-red">*</span> 登录密码：</span>
			    	<div class="col-sm-8 input-group"><input class="form-control" type="password" name="password"></div>
			  	</div>
			  	<div class="form-group">
				    <span class="col-sm-2 control-label">性别：</span>
				    <div class="col-sm-2 input-group">
					<select class="form-control" name="sex">
						<option>请选择</option>
						{{volist name="sexArray" id="value"}}
						<option value="{{$key}}">{{$value}}</option>
						{{/volist}}
					</select>
				    </div>
				</div>
				<div class="form-group">
				    <span class="col-sm-2 control-label">邮箱：</span>
				    <div class="col-sm-2 input-group">
				      <input class="form-control" name="email" >
				    </div>
				</div>
				<div class="form-group">
				    <span class="col-sm-2 control-label">电话：</span>
				    <div class="col-sm-2 input-group">
				      <input class="form-control" name="phone" >
				    </div>
				</div>
				<div class="form-group">
				    <span class="col-sm-2 control-label">备注：</span>
				    <div class="col-sm-2 input-group">
				      <textarea class="form-control" rows="3" name="remark"></textarea>
				    </div>
				</div>
				<div class="form-group">
				    <span class="col-sm-2 control-label">状态：</span>
				    <div class="col-sm-2 input-group">
					<select class="form-control" name="status">
						<option value="1">开启</option>
						<option value="0">关闭</option>
					</select>
				    </div>
				</div>
			</div>
			<div class="foot_btn_blank"></div>
            <div class="foot_btn">
                <div class="box">
                    <button type="submit" class="btn btn-primary">提交信息</button>
                </div>
            </div>
		</form>
	</div>
</div>
{{include file="layouts/_foot"}}
{{include file="shared/_jquery_validation"}}
<script type="text/javascript">
$("#form").validate({
	rules: {
		username: {required: true},
		password: {required: true},
	},
	messages: {
		username: '用户名不能为空',
		password: '登录密码不能为空'
	},
	submitHandler:function(){
		layer.confirm('确认提交？', function() {
			layer.closeAll(); var load = layer.load();
			$("#form").ajaxSubmit(function(res) {
				layer.close(load);
                if (res.code == 401) {
                    goLogin(); return false;
                }
                if (res.code == 200) {
                    layer.msg('提交成功', { time: 1500 }, function () { window.location.href = '{{:url("/admin/administrator")}}' });
                } else if (res.code == 400) {
                    layer.msg(res.message); return false;
                } else {
                    layer.msg('操作失败'); return false;
                }
			});
		});	
	}
});

</script>
</body>
</html>